From: Haoyu Zhang Date: Mon, 6 Feb 2012 21:23:41 +0000 (-0800) Subject: Fix error recovery path in __gnttab_map_grant_ref X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=62698cdaf331db0ba7f621040b5c63eaacf6c4a9;p=xen.git Fix error recovery path in __gnttab_map_grant_ref In file grant_table.c function __gnttab_map_grant_ref, if __get_paged_frame failed, the effect of _set_status previously called should be rollback, so the flag GTF_reading and _GTF_writing will be recovered. Signed-off-by: Haoyu Zhang Signed-off-by: Liang Wang Acked-by: Andres Lagar-Cavilla Committed-by: Keir Fraser --- diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 858d991d3d..6bf611f657 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -576,7 +576,7 @@ __gnttab_map_grant_ref( if ( rc != GNTST_okay ) { gfn = INVALID_GFN; - goto unlock_out; + goto unlock_out_clear; } act->gfn = gfn; act->domid = ld->domain_id; @@ -734,7 +734,8 @@ __gnttab_map_grant_ref( if ( op->flags & GNTMAP_host_map ) act->pin -= (op->flags & GNTMAP_readonly) ? GNTPIN_hstr_inc : GNTPIN_hstw_inc; - + + unlock_out_clear: if ( !(op->flags & GNTMAP_readonly) && !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) ) gnttab_clear_flag(_GTF_writing, status);